package com.nerve.android.cloudoffice.common;

/**
 * @project cloudOffice Reply.java
 * @datetime Aug 2, 2013 1:39:58 AM
 * @description 
 * 	交互中使用到的应答数据体
 * 
 *  data 属性保存的是一些额外的数据
 * @author 集成显卡 IBM 
 *			zxingming@qq.com
 *			zengxm@cn.ibm.com
 *
 * @change log:
 *
 */
public class Reply {
	private boolean error;
	private Object message;
	private Object data;
	
	public boolean isError() {
		return error;
	}
	public void setError(boolean error) {
		this.error = error;
	}
	public Object getMessage() {
		return message;
	}
	public void setMessage(Object message) {
		if(message instanceof Exception){
			Exception e = (Exception)message;
			if(e.getMessage() == null)
				message = e.toString();
			else
				message = e.getMessage();
		}
		this.message = message;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	
	/**
	 * @method name: error
	 * @description: 标记为出错
	 * @return type: void
	 *	@param e
	 */
	public void error(Exception e){
		this.error = true;
		setMessage(e);
	}
}